home *** CD-ROM | disk | FTP | other *** search
/ EuroCD 3 / EuroCD 3.iso / Games / Doom / ADoom-0.8 / ADoom_src / amiga_main.c < prev    next >
C/C++ Source or Header  |  1998-06-24  |  5KB  |  182 lines

  1. // Emacs style mode select   -*- C++ -*- 
  2. //-----------------------------------------------------------------------------
  3. //
  4. // $Id:$
  5. //
  6. // Copyright (C) 1993-1996 by id Software, Inc.
  7. //
  8. // This source is available for distribution and/or modification
  9. // only under the terms of the DOOM Source Code License as
  10. // published by id Software. All rights reserved.
  11. //
  12. // The source is distributed in the hope that it will be useful,
  13. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
  15. // for more details.
  16. //
  17. // $Log:$
  18. //
  19. // DESCRIPTION:
  20. //    Main program, simply calls D_DoomMain high level loop.
  21. //
  22. //-----------------------------------------------------------------------------
  23.  
  24. const char amigaversion[] = "$VER: ADoom 0.8 " __AMIGADATE__ ;
  25.  
  26. long __oslibversion = 38;    /* we require at least OS3.0 for LoadRGB32() */
  27. char __stdiowin[] = "CON:20/50/500/130/ADoom";
  28. char __stdiov37[] = "/AUTO/CLOSE/WAIT";
  29.  
  30. #include <stdio.h>
  31. #include <stdlib.h>
  32.  
  33. #include <exec/exec.h>
  34. #include <workbench/startup.h>
  35. #include <workbench/workbench.h>
  36. #include <workbench/icon.h>
  37.  
  38. #include <proto/exec.h>
  39. #include <proto/icon.h>
  40.  
  41. #include "doomdef.h"
  42.  
  43. #include "m_argv.h"
  44. #include "d_main.h"
  45. #include "i_system.h"
  46. #include "m_fixed.h"
  47.  
  48. /**********************************************************************/
  49. extern struct ExecBase *SysBase;
  50.  
  51. int cpu_type;
  52.  
  53. /**********************************************************************/
  54. int main (int argc, char* argv[])
  55.   struct WBStartup *argmsg;
  56.   struct WBArg *wb_arg;
  57.   struct DiskObject *obj;
  58.   char **toolarray, *s;
  59.   int i;
  60.  
  61.   /* these command line arguments are flags */
  62.   static char *flags[] = {
  63.     "-forcedemo",
  64.     "-changepitch",
  65.     "-mouse",
  66.     "-joypad",
  67.     "-music",
  68.     "-nosfx",
  69.     "-fps",
  70.     "-rotatemap",
  71.     "-maponhu",
  72.     "-maxdemo",
  73.     "-nodraw",
  74.     "-noblit",
  75.     "-debugfile",
  76.     "-shdev",
  77.     "-regdev",
  78.     "-comdev",
  79.     "-nomonsters",
  80.     "-respawn",
  81.     "-fast",
  82.     "-devparm",
  83.     "-altdeath",
  84.     "-deathmatch",
  85.     "-cdrom",
  86.     "-turbo",
  87.     "-playdemo",
  88.     "-avg"
  89.   };
  90.   /* these command line arguments each take a value */
  91.   static char *settings[] = {
  92.     "-screenmode",
  93.     "-taskpriority",
  94.     "-mmu",
  95.     "-heapsize",
  96.     "-file",
  97.     "-timedemo",
  98.     "-skill",
  99.     "-episode",
  100.     "-timer",
  101.     "-statcopy",
  102.     "-record",
  103.     "-playdemo",
  104.     "-timedemo",
  105.     "-loadgame",
  106.     "-config"
  107.   };
  108.  
  109.   printf ("%s\n", &amigaversion[6]);
  110.  
  111.   myargc = argc;
  112.   if ((myargv = malloc(sizeof(char *)*MAXARGVS)) == NULL)
  113.     I_Error ("malloc(%d) failed", sizeof(char *)*MAXARGVS);
  114.   memset (myargv, 0, sizeof(char *)*MAXARGVS);
  115.   memcpy (myargv, argv, sizeof(char *)*myargc);
  116.  
  117.   /* parse icon tooltypes and convert them to argc/argv format */
  118.   if (argc == 0) {
  119.     argmsg = (struct WBStartup *)argv;
  120.     wb_arg = argmsg->sm_ArgList;
  121.     if ((myargv[myargc] = malloc(strlen(wb_arg->wa_Name)+1)) == NULL)
  122.       I_Error ("malloc(%d) failed", strlen(wb_arg->wa_Name)+1);
  123.     strcpy (myargv[myargc++], wb_arg->wa_Name);
  124.   }
  125.   if ((obj = GetDiskObject (myargv[0])) != NULL) {
  126.     toolarray = obj->do_ToolTypes;
  127.     for (i = 0; i < sizeof(flags)/sizeof(flags[0]); i++) {
  128.       if (FindToolType (toolarray, &flags[i][1]) != NULL) {
  129.         myargv[myargc++] = flags[i];
  130.       }
  131.     }
  132.     for (i = 0; i < sizeof(settings)/sizeof(settings[0]); i++) {
  133.       if ((s = FindToolType (toolarray, &settings[i][1])) != NULL) {
  134.         myargv[myargc++] = settings[i];
  135.         if ((myargv[myargc] = malloc(strlen(s)+1)) == NULL)
  136.           I_Error ("malloc(%d) failed", strlen(s)+1);
  137.         strcpy(myargv[myargc++], s);
  138.       }
  139.     }
  140.     FreeDiskObject (obj);
  141.   }
  142.  
  143.   if (argc != myargc) {
  144.     printf ("\nIcon tooltypes translated command line to:\n\n    ");
  145.     for (i = 0; i < myargc; i++)
  146.       printf (" %s", myargv[i]);
  147.     printf ("\n\n");
  148.   }
  149.  
  150.   if ((SysBase->AttnFlags & AFF_68060) != 0)
  151.     cpu_type = 68060;
  152.   else if ((SysBase->AttnFlags & AFF_68040) != 0)
  153.     cpu_type = 68040;
  154.   else if ((SysBase->AttnFlags & AFF_68030) != 0)
  155.     cpu_type = 68030;
  156.   else if ((SysBase->AttnFlags & AFF_68020) != 0)
  157.     cpu_type = 68020;
  158.   else if ((SysBase->AttnFlags & AFF_68010) != 0)
  159.     cpu_type = 68010;
  160.   else
  161.     cpu_type = 68000;
  162.  
  163.   if (cpu_type >= 68060) {
  164.     if ((SysBase->AttnFlags & AFB_68881) != 0) {
  165.       SetFPMode ();  /* set FPU rounding mode to "trunc towards -infinity" */
  166.       FixedMul = FixedMul_060fpu;
  167.       FixedDiv = FixedDiv_060fpu;
  168.     } else {
  169.       FixedMul = FixedMul_060;
  170.       FixedDiv = FixedDiv_040;
  171.     }
  172.   } else {
  173.     FixedMul = FixedMul_040;
  174.     FixedDiv = FixedDiv_040;
  175.   }
  176.  
  177.   D_DoomMain ();
  178.  
  179.   return 0;
  180. }
  181.